#ifndef __BUZZER_H__
#define __BUZZER_H__

#include "bsp_system.h"

typedef struct {
    uint8_t is_running; // 蜂鸣器是否在运行
    uint8_t state; // 当前状态 0: off, 1: on
    uint16_t count; // 当前计数
    uint16_t target_count; // 目标计数
    uint32_t on_time; // 开启时间
    uint32_t off_time; // 关闭时间
    uint32_t last_tick; // 上次操作的时间戳
} BUzzerControl_t;

extern BUzzerControl_t buzzer_control;
extern uint8_t buzzer_state; // 0: off, 1: on
extern uint16_t buzz_on_time; // 蜂鸣器开启时间

void buzzer_on(void);
void buzzer_off(void);  
void buzzer_beep(uint8_t times, uint32_t on_ms, uint32_t off_ms);
void buzzer_run(void);




#endif 





